/**
 * 
 */
package com.williamoneil.charts.server.util;

import java.util.Date;

import com.williamoneil.charts.shared.ResponseHeader;

/**
 * @author Gudipati
 *
 */
public final class ResponseUtil {

	private ResponseUtil() {
	}
	
	public static final ResponseHeader getSuccessHeader() {
		final ResponseHeader header = new ResponseHeader();
		header.setError(false);
		header.setResponseTime(new Date());
		
		return header;
	}
	
	public static final ResponseHeader getErrorHeader(final Exception ex) {
		return getErrorHeader(ex.getMessage());
	}
	
	public static final ResponseHeader getErrorHeader(final String errorMessage) {
		final ResponseHeader header = new ResponseHeader();
		header.setError(true);
		header.setErrorMessage(errorMessage);
		header.setResponseTime(new Date());
		
		return header;
	}
}
